import request from '@/config/axios'

import { BaseModel } from '@/api/common/baseModel'

/**
 * 物料品牌
 */
export interface Model extends BaseModel {
  /**
   * 品牌图片
   */
  picUrl: string

  /**
   * 品牌描述
   */
  description?: string
}

// 更新物料品牌
export const update = (data: Model) => {
  return request.put({
    url: import.meta.env.VITE_BASE_ROLE + '/userCenter/purchase/stock/update.json',
    data
  })
}

// 删除物料品牌
export const del = (id: string) => {
  return request.delete({ url: import.meta.env.VITE_BASE_ROLE + `/userCenter/purchase/stock/del.json?id=${id}` })
}

// 获得物料品牌
export const getById = (id: string) => {
  return request.get({ url: import.meta.env.VITE_BASE_ROLE + `/userCenter/purchase/stock/getById.json?id=${id}` })
}

// 获得物料品牌列表
export const getPage = (params: PageParam) => {
  return request.get({
    url: import.meta.env.VITE_BASE_ROLE + '/userCenter/purchase/stock/page.json',
    params
  })
}

// 获得物料品牌列表
export const arr = (params: PageParam | null) => {
  return request.get({
    url: import.meta.env.VITE_BASE_ROLE + '/userCenter/purchase/stock/arr.json',
    params
  })
}
